package fr.compil.tab.ihm;

import javax.swing.table.AbstractTableModel;

import fr.compil.tab.model.Board;
import fr.compil.tab.model.Cell;

public class TableModel extends AbstractTableModel {

	private Board board;
	
	public TableModel(Board board){
		this.board = board;
		for (int i = 0; i < getRowCount(); i++) {
			for (int j = 0; j < getColumnCount(); j++) {
				Cell c = new Cell(i,j, board);
				board.getBoard()[i][j] = c;
			}
			
		}
	}
	
	@Override
	public int getColumnCount() {
		// TODO Auto-generated method stub
		return 27;
	}

	@Override
	public int getRowCount() {
		// TODO Auto-generated method stub
		return 200;
	}

	@Override
	public Object getValueAt(int arg0, int arg1) {

	
		if(arg0 == 0){
			return "row";
		}
		if(arg1 == 0){
			return "col";
		}
		
		return board.getBoard()[arg0-1][arg1-1].getProcessedValue();
	}

}
